package sm.dbdict.def;

public class SqlLookupTableKeys implements Cloneable {
	private String sqlLookupField;

	private String sqlLookupColumn;

	public String getSqlLookupField() {
		return sqlLookupField;
	}

	public void setSqlLookupField(String sqlLookupField) {
		this.sqlLookupField = sqlLookupField;
	}

	public String getSqlLookupColumn() {
		return sqlLookupColumn;
	}

	public void setSqlLookupColumn(String sqlLookupColumn) {
		this.sqlLookupColumn = sqlLookupColumn;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((sqlLookupColumn == null) ? 0 : sqlLookupColumn.hashCode());
		result = prime * result
				+ ((sqlLookupField == null) ? 0 : sqlLookupField.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SqlLookupTableKeys other = (SqlLookupTableKeys) obj;
		if (sqlLookupColumn == null) {
			if (other.sqlLookupColumn != null)
				return false;
		} else if (!sqlLookupColumn.equals(other.sqlLookupColumn))
			return false;
		if (sqlLookupField == null) {
			if (other.sqlLookupField != null)
				return false;
		} else if (!sqlLookupField.equals(other.sqlLookupField))
			return false;
		return true;
	}

	@Override
	public Object clone() {
		try {
			SqlLookupTableKeys clonedObj = (SqlLookupTableKeys) super.clone();
			clonedObj.sqlLookupColumn = sqlLookupColumn;
			clonedObj.sqlLookupField = sqlLookupField;
			return clonedObj;
		} catch (CloneNotSupportedException e) {
			// this shouldn't happen, since we are Cloneable
			throw new InternalError();
		}
	}
}
